$OpenBSD: patch-config_tests_x11_xfreetype_test,v 1.1 2014/01/10 18:10:36 naddy Exp $
--- config.tests/x11/xfreetype.test.orig	Mon Aug  9 22:16:57 2004
+++ config.tests/x11/xfreetype.test	Wed Jan  8 21:46:48 2014
@@ -116,29 +116,31 @@ fi
 # check for freetype2 headers
 FREETYPE2_INCDIR=
 if [ "$XFT" = "yes" ]; then
-    INC="freetype2/freetype/freetype.h"
+    INCS="freetype2/freetype.h freetype2/freetype/freetype.h"
     XDIRS=`sed -n -e '/^QMAKE_INCDIR_X11[	]*=/ { s/[^=]*=[	 ]*//; s/-I/ /g; p; }' $XCONFIG`
     LDIRS=`sed -n -e '/^QMAKE_INCDIR[	]*=/ { s/[^=]*=[	 ]*//; s/-I/ /g; p; }' $XCONFIG`
     INCDIRS="$IN_INCDIRS $XDIRS $LDIRS /usr/include /include"
     F=
-    for INCDIR in $INCDIRS; do
-	if [ -f $INCDIR/$INC ]; then
-	    # detect major version of freetype2
-	    FREETYPE_MAJOR=`grep "#define FREETYPE_MAJOR" $INCDIR/$INC | head -n 1 | awk '{ print \$3 }'`
-	    FREETYPE_MINOR=`grep "#define FREETYPE_MINOR" $INCDIR/$INC | head -n 1 | awk '{ print \$3 }'`
-	    FREETYPE_PATCH=`grep "#define FREETYPE_PATCH" $INCDIR/$INC | head -n 1 | awk '{ print \$3 }'`
-	    test -z "$FREETYPE_PATCH" && FREETYPE_PATCH="0"
-	    [ "$VERBOSE" = "yes" ] && \
-		echo "  Found Freetype version $FREETYPE_MAJOR.$FREETYPE_MINOR.$FREETYPE_PATCH"
-	    if [ "$FREETYPE_MAJOR" -eq "2" ] \
-               && [ "$FREETYPE_MINOR" -ge "0" -a "$FREETYPE_PATCH" -ge "9" ] \
-               || [ "$FREETYPE_MINOR" -ge "1" ]; then
-		F=yes
-		FREETYPE2_INCDIR=$INCDIR/freetype2
-		[ "$VERBOSE" = "yes" ] && echo "  Found $INC in $INCDIR"
-		break
+    for INC in $INCS; do
+	for INCDIR in $INCDIRS; do
+	    if [ -f $INCDIR/$INC ]; then
+		# detect major version of freetype2
+		FREETYPE_MAJOR=`grep "#define FREETYPE_MAJOR" $INCDIR/$INC | head -n 1 | awk '{ print \$3 }'`
+		FREETYPE_MINOR=`grep "#define FREETYPE_MINOR" $INCDIR/$INC | head -n 1 | awk '{ print \$3 }'`
+		FREETYPE_PATCH=`grep "#define FREETYPE_PATCH" $INCDIR/$INC | head -n 1 | awk '{ print \$3 }'`
+		test -z "$FREETYPE_PATCH" && FREETYPE_PATCH="0"
+		[ "$VERBOSE" = "yes" ] && \
+		    echo "  Found Freetype version $FREETYPE_MAJOR.$FREETYPE_MINOR.$FREETYPE_PATCH"
+		if [ "$FREETYPE_MAJOR" -eq "2" ] \
+		   && [ "$FREETYPE_MINOR" -ge "0" -a "$FREETYPE_PATCH" -ge "9" ] \
+		   || [ "$FREETYPE_MINOR" -ge "1" ]; then
+		    F=yes
+		    FREETYPE2_INCDIR=$INCDIR/freetype2
+		    [ "$VERBOSE" = "yes" ] && echo "  Found $INC in $INCDIR"
+		    break 2
+		fi
 	    fi
-	fi
+	done
     done
     if [ -z "$F" ]; then
 	XFT=no
